require 'models/belongs_to_entity'


class Action < MudBase
include BelongsToEntity

    attr_accessor :type, :data
    
    # [+type+] Symbol identifying the action
    # [+performer+] Entity performing the action
    # [+data+] A free-form hash containing information about the action
    def initialize(type,performer,data={})
        self.type = type
        self.owner = performer
        self.data = data
    end
    # Alias for owner
    def performer
        self.owner
    end
    def to_s
        "\n\tPerformer: #{self.performer} \n\tAction: #{self.type} \n\tData: {" + 
        self.data.collect{|k,v| ":#{k}=>#{v.to_s.sub("\r\n",'')}"}.join(', ') +
        "}"
    end
end